//
//  ViewController.swift
//  FactoryPattern
//
//  Created by 好米有易 on 2017/12/12.
//  Copyright © 2017年 好米有易. All rights reserved.
//

import UIKit

class ViewController: UIViewController {

    lazy var shapeFactory: ShapeFactory = {
        
        let shapeFactory = ShapeFactory()
        
        return shapeFactory;
    }()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
    }

    @IBAction func drawCircle(_ sender: Any) {
        
        let circle: Shape = shapeFactory.getShape(shapeType: "CIRCLE")
        
         circle.draw()
    }
    
    @IBAction func drawRectangle(_ sender: Any) {
        
        let rectangle: Shape = shapeFactory.getShape(shapeType: "RECTANGLE")
        
            rectangle.draw()
    }
    
    @IBAction func drawSquare(_ sender: Any) {
        
        let square: Shape = shapeFactory.getShape(shapeType: "SQUARE")
        
            square.draw()
    }

}

